package com.mindainfo.groundwave.web.device.web;

import com.mindainfo.groundwave.common.api.device.service.IDeviceOperateService;
import com.mindainfo.groundwave.common.api.device.service.IEventReportService;
import com.mindainfo.groundwave.common.api.device.vo.EventReportVo;
import com.mindainfo.groundwave.common.bean.CommonResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * Created by MD-01 on 2017/6/13.
 */
@Controller
@RequestMapping("/sys/door")
public class DoorController {

    @Resource
    private IEventReportService reportService;
    @Resource
    private IDeviceOperateService deviceOperateService;

    @RequestMapping("/event")
    @ResponseBody
    public CommonResult<List<EventReportVo>> event(){

        return reportService.queryEvent();
    }

    @RequestMapping("/open")
    @ResponseBody
    public CommonResult<Void> open(Integer doorId){

        return deviceOperateService.open(doorId);
    }

    @RequestMapping("/page")
    public String page(){
        return "/map/dutymap";
    }
}
